home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung / Power-Programmierung (Tewi)(1994).iso / perl / os2perl / cmdopt.t < prev    next >
Text File  |  1991-04-12  |  3KB  |  84 lines

  1. #!./perl
  2.  
  3. # $Header: cmdopt.t,v 4.0 91/03/20 01:49:58 lwall Locked $
  4.  
  5. print "1..40\n";
  6.  
  7. # test the optimization of constants
  8.  
  9. if (1) { print "ok 1\n";} else { print "not ok 1\n";}
  10. unless (0) { print "ok 2\n";} else { print "not ok 2\n";}
  11.  
  12. if (0) { print "not ok 3\n";} else { print "ok 3\n";}
  13. unless (1) { print "not ok 4\n";} else { print "ok 4\n";}
  14.  
  15. unless (!1) { print "ok 5\n";} else { print "not ok 5\n";}
  16. if (!0) { print "ok 6\n";} else { print "not ok 6\n";}
  17.  
  18. unless (!0) { print "not ok 7\n";} else { print "ok 7\n";}
  19. if (!1) { print "not ok 8\n";} else { print "ok 8\n";}
  20.  
  21. $x = 1;
  22. if (1 && $x) { print "ok 9\n";} else { print "not ok 9\n";}
  23. if (0 && $x) { print "not ok 10\n";} else { print "ok 10\n";}
  24. $x = '';
  25. if (1 && $x) { print "not ok 11\n";} else { print "ok 11\n";}
  26. if (0 && $x) { print "not ok 12\n";} else { print "ok 12\n";}
  27.  
  28. $x = 1;
  29. if (1 || $x) { print "ok 13\n";} else { print "not ok 13\n";}
  30. if (0 || $x) { print "ok 14\n";} else { print "not ok 14\n";}
  31. $x = '';
  32. if (1 || $x) { print "ok 15\n";} else { print "not ok 15\n";}
  33. if (0 || $x) { print "not ok 16\n";} else { print "ok 16\n";}
  34.  
  35.  
  36. # test the optimization of registers
  37.  
  38. $x = 1;
  39. if ($x) { print "ok 17\n";} else { print "not ok 17\n";}
  40. unless ($x) { print "not ok 18\n";} else { print "ok 18\n";}
  41.  
  42. $x = '';
  43. if ($x) { print "not ok 19\n";} else { print "ok 19\n";}
  44. unless ($x) { print "ok 20\n";} else { print "not ok 20\n";}
  45.  
  46. # test optimization of string operations
  47.  
  48. $a = 'a';
  49. if ($a eq 'a') { print "ok 21\n";} else { print "not ok 21\n";}
  50. if ($a ne 'a') { print "not ok 22\n";} else { print "ok 22\n";}
  51.  
  52. if ($a =~ /a/) { print "ok 23\n";} else { print "not ok 23\n";}
  53. if ($a !~ /a/) { print "not ok 24\n";} else { print "ok 24\n";}
  54. # test interaction of logicals and other operations
  55.  
  56. $a = 'a';
  57. $x = 1;
  58. if ($a eq 'a' && $x) { print "ok 25\n";} else { print "not ok 25\n";}
  59. if ($a ne 'a' && $x) { print "not ok 26\n";} else { print "ok 26\n";}
  60. $x = '';
  61. if ($a eq 'a' && $x) { print "not ok 27\n";} else { print "ok 27\n";}
  62. if ($a ne 'a' && $x) { print "not ok 28\n";} else { print "ok 28\n";}
  63.  
  64. $x = 1;
  65. if ($a eq 'a' || $x) { print "ok 29\n";} else { print "not ok 29\n";}
  66. if ($a ne 'a' || $x) { print "ok 30\n";} else { print "not ok 30\n";}
  67. $x = '';
  68. if ($a eq 'a' || $x) { print "ok 31\n";} else { print "not ok 31\n";}
  69. if ($a ne 'a' || $x) { print "not ok 32\n";} else { print "ok 32\n";}
  70.  
  71. $x = 1;
  72. if ($a =~ /a/ && $x) { print "ok 33\n";} else { print "not ok 33\n";}
  73. if ($a !~ /a/ && $x) { print "not ok 34\n";} else { print "ok 34\n";}
  74. $x = '';
  75. if ($a =~ /a/ && $x) { print "not ok 35\n";} else { print "ok 35\n";}
  76.     if ($a !~ /a/ && $x) { print "not ok 36\n";} else { print "ok 36\n";}
  77.  
  78. $x = 1;
  79. if ($a =~ /a/ || $x) { print "ok 37\n";} else { print "not ok 37\n";}
  80. if ($a !~ /a/ || $x) { print "ok 38\n";} else { print "not ok 38\n";}
  81. $x = '';
  82. if ($a =~ /a/ || $x) { print "ok 39\n";} else { print "not ok 39\n";}
  83. if ($a !~ /a/ || $x) { print "not ok 40\n";} else { print "ok 40\n";}
  84.